package com.hws.leetcode.Day_01_15;

/**
 * ClassName:leetcode_1716
 * Package:com.hws.leetcode.Day_01_15
 * Description:
 *
 * @ date:2022/1/15 9:58
 * @ author:hws
 */
public class leetcode_1716 {

    public int totalMoney(int n) {
        if (n <= 0) {
            return 0;
        }
        int num = n / 7;
        int sum = 0;
        for (int i = 1; i <= num; i++) {
            sum += (i + i + 6) * 7 / 2;
        }
        int remain = (num + 1 + (num + 1) + (n - 7 * num - 1)) * (n - 7 * num) / 2;
        sum += remain;
        return sum;
    }

    public static void main(String[] args) {
        leetcode_1716 lc = new leetcode_1716();
        System.out.println(lc.totalMoney(20));
    }

}
